#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<iterator>
using namespace std;
int a[10000]= {0};
int search(int b[],int l,int r,int num) {
	while(l<r) {
		int mid=(l+r)/2;
		if(b[(l+r)/2]<num) {
			l=mid;
		} else {
			r=mid;
		}
		if(b[(l+r)/2]==num) {
			break;
		}
	}
	return l;
}
int main() {
	freopen("sort2.in","r",stdin);
	freopen("sort.out","w",stdout);
	int n,q;
	cin>>n>>q;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	for(int i=1; i<=q; i++) {
		int op,point;
		cin>>op;
		if(op==1) {
			int num;
			cin>>point>>num;
			a[point]=num;
		}
		if(op==2) {
			cin>>point;
			int b[10000];
			for(int i=1; i<=n; i++) {
				b[i]=a[i];
			}
			sort(b+1,b+n+1);
			cout<<search(b,1,n,a[point])<<endl;
		}
	}
	fclose(stdin);
	fclose(stdout);
}
